<template>
    <div :class="state ? 'PurchaseTakedetail flex mt-10 w754 ' : 'PurchaseTakedetail flex mt-10  w1034'">
        <el-table :data="takeDetailList" class="width font">
            <el-table-column fixed label="Model" prop="Model" width="200" />
            <el-table-column label="LeadingTime" prop="lead" width="170" />
            <el-table-column label="Qty" prop="Qtynumber" />
            <el-table-column prop="purchaser" label="Purchase" />
            <el-table-column v-if="allocationState" label="ChoosePurchase" width="150">
                <template v-slot="purcharse">
                    <el-select :disabled="purcharse.row.Qtynumber == 0 ? true : false" v-model="purcharse.row.purcharse">
                        <el-option v-for="item in buyerList" :key="item.id" :label="item.name" :value="item.id" />
                    </el-select>
                </template>
            </el-table-column>
            <el-table-column v-if="allocationState" label="Allotment" width="100">
                <template v-slot="quantity">
                    <el-input :disabled="quantity.row.Qtynumber == 0 ? true : false" @input="emits('compare',quantity.row)" v-model="quantity.row.quantity" />
                </template>
            </el-table-column>
            <el-table-column label="Price" prop="Price" />
            <el-table-column prop="stock_number" label="Inventory" width="100" />
            <el-table-column prop="use_number" label="AvailableStock" width="120" />
            <el-table-column prop="occupy_number" label="OccupiedInventory" width="150" />
            <el-table-column label="Brand" prop="Brand_name" width="150" />
            <el-table-column align="center" fixed="right" label="Operation" width="150">
                <template v-slot="Purchaseordertesk_detailed_id">
                    <el-button
                        @click="emits('returnTask', Purchaseordertesk_detailed_id.row.Purchaseordertesk_detailed_id)"
                        style="width: 60%;background-color:#6193D2;color: #fff;border: none;"
                        type="danger">ReturnTask</el-button>
                </template>
            </el-table-column>
        </el-table>
    </div>
</template>

<script setup>

const props = defineProps({
    takeDetailList: Object,
    state: Boolean,
    allocationState: Boolean,
    buyerList: Object
})
const emits = defineEmits(['returnTask','compare'])



</script>

<style lang="less">
.PurchaseTakedetail {
    border-radius: 10px;
    box-sizing: border-box;

    .el-input__inner {
        font-family: swis;
    }

    .el-table .cell {
        padding: 0;
    }

    .width {
        width: 100%;
        height: 372px;
        padding: 10px;
        border-radius: 10px;
    }

    .el-table .cell {
        padding-right: 10px;
    }

}
</style>